<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="org.simon.myauctioneer.dto.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>myauctioneer</title>
<script src="js/datetimepicker_css.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<%User user = (User) session.getAttribute("user"); %>
<body>
	<div id="container">
		<div id="header">
			<h1>myauctioneer</h1>
		</div>
		<div id="search">
			<form action="search" method="get">
				<table>
					<tr>
						<td><input type="text" name="search_field" id="search_field"
							value="full text search" /></td>
						<td><select name="search_category" size="1">
								<option>all</option>
								<option>smartphone</option>
								<option>notebook</option>
								<option>tablet</option>
						</select></td>
						<td><label> <input type="radio"
								name="search_condition" value="new" id="search_condition_new" />
								new
						</label> <label> <input type="radio" name="search_condition"
								value="used" id="search_condition_used" /> used
						</label></td>
						<td><input name="search_button" type="button"
							id="search_button" value="Search" /></td>
					</tr>
				</table>
			</form>
		</div>
		<div id="content">
			<h1>Create new article</h1>
			<p>
				<form action="createArticle" method="post">
					<table>
						<tr>
							<td><label for="brand">Brand</label></td>
							<td><input type="text" name="brand" id="brand" /></td>
						</tr>
						<tr>
							<td><label for="familyLine">Family Line</label></td>
							<td><input type="text" name="familyLine" id="familyLine" /></td>
						</tr>
						<tr>
							<td><label for="model">Model</label></td>
							<td><input type="text" name="model" id="model" /></td>
						</tr>
						<tr>
							<td><label for="condition">Condition</label></td>
							<td><select name="condition" size="1">
									<option value="all">all</option>
									<option value="new">new</option>
									<option value="used">used</option>
							</select></td>
						</tr>
						<tr>
							<td><label for="description">Description</label></td>
							<td><textarea name="description" cols="50" rows="5"
									id="description"></textarea></td>
						</tr>
						<tr>
							<td><label for="validUntil">Valid Until</label></td>
							<td><input type="text" name="validUntil" id="validUntil" /><img
								src="images2/cal.gif"
								onclick="javascript:NewCssCal ('validUntil','ddMMyyyy','dropdown',true,'24')"
								style="cursor: pointer" /></td>
						</tr>
						<tr>
							<td><label for="category">Category</label></td>
							<td><select name="category" size="1">
									<option value="smartphone">smartphone</option>
									<option value="notebook">notebook</option>
									<option value="tablet">tablet</option>
							</select></td>
						</tr>
						<tr>
							<td><label for="price">Price</label></td>
							<td><input type="text" name="price" id="price" /></td>
						</tr>
						<tr>
							<td><label for="saleType">Sale Type</label></td>
							<td><select name="saleType" size="1">
									<option value="auction">auction</option>
									<option value="directSale">direct sale</option>
							</select></td>
						</tr>
						<tr>
							<td><input type="hidden" name="userId" value="<%= user.getUserId() %>"></td>
							<td><input type="submit" value="Create article" /></td>
						</tr>
					</table>
				</form>
			</p>
		</div>
		<div id="navi">
			<%
				if (session.getAttribute("user") == null) {
					out.println("<form action=\"login\" method=\"post\">");
					out.println("<table>");
					out.println("<tr>");
					out.println("<td><label for=\"email\">E-Mail</label><br /><input type=\"text\" name=\"email\" id=\"email\" /></td>");
					out.println("</tr>");
					out.println("<tr>");
					out.println("<td><label for=\"password\">Password</label><br /><input type=\"password\" name=\"password\" id=\"password\" /></td>");
					out.println("</tr>");
					out.println("<tr>");
					out.println("<td><input type=\"submit\" value=\"Login\" class=\"button\" /></td>");
					out.println("</tr>");
					out.println("</table>");
					out.println("</form>");
					out.println("<p><a href=\"register.jsp\">Register now</a></p>");
				} else {
					out.println("<ul>");
					out.println("<li><a href=\"createArticle.jsp\">Create article</a></li>");
					out.println("<li><a href=\"showArticles.jsp\">Change article details</a></li>");
					out.println("<li><a href=\"logout\">Logout</a></li>");
					out.println("</ul>");
					out.println("<p>Eingeloggt als: <em>" + user.getName()
							+ "</em></p>");
				}
			%>
		</div>
		<div id="footer">Copyright &copy; 2011 myauctioneer</div>
	</div>
</body>
</html>
